for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
/** global: UB */
//removeIf(nodejs)
var objectFuncs = {
encodeJSON: function() {
var object = this;
try {
return JSON.stringify(object);
} catch (err) {
}
return "{}";
},
none:null,
// register funcs
UB.registerFuncs(Object.prototype, objectFuncs);
var stringFuncs = {
decodeJSON: function () {
var data = this.toString();
return JSON.parse(data);
return null;
UB.registerFuncs(String.prototype, stringFuncs);
/* File Utils - NodeJS only */
var fs = require('fs');
objectFuncs = {
saveToJSON: function(filePath) {
var data = this;
// write JSON to string
var str = data.encodeJSON();
// save data as string via filestream
str.saveToText(filePath);
stringFuncs = {
loadJSON: function(encoding = "utf8") {
// load text file
var file = this.toString();
var text = file.loadText(encoding);
if (text == null) {
// parse JSON string into Object
return text.decodeJSON();
//endRemoveIf(nodejs)